package com.wm.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: ListCollection
 * @Description: 集合实现类
 * @Author: WM
 * @Date: 2023/5/8 10:25
 */
public class ListCollection implements Collection {
    // list用于存储数据
    List list = new ArrayList();

    @Override
    public Iterator iterator() {
        return new ConcreteIterator(this);
    }

    @Override
    public Object get(int i) {
        return list.get(i);
    }

    @Override
    public boolean add(Object object) {
        return list.add(object);
    }

    @Override
    public int size() {
        return list.size();
    }
}
